package com.example.summary.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * Created by wzn on 2019/1/16.
 */
//@Component
//public class FactoryBean2 implements BeanPostProcessor, BeanFactoryPostProcessor {
//
//    @Override
//    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
//        System.out.println("postProcessBeforeInitialization||" + beanName);
//        if (bean instanceof MyFactoryBean) {
//            ((MyFactoryBean) bean).setName("aaaa");
//        }
//        return bean;
//    }
//
//
//    @Override
//    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
//        System.out.println("postProcessAfterInitialization||" + beanName);
//        return null;
//    }
//
//    @Override
//    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
////        BeanDefinition factoryBean = configurableListableBeanFactory.getBeanDefinition("factoryBean");
////        System.out.println("==============");
////        factoryBean.getPropertyValues().add("name", "123");
//    }
//}
